package com.liao.utils;

import com.liao.constants.Constant;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.ipc.RpcServer;

import java.io.IOException;

public class ConnectionInstance {
    private static Connection connection;
    private ConnectionInstance() {

    }
    public static Connection getInstance(){
        //connection == null
        if(connection == null || connection.isClosed()){
            try {
                connection= ConnectionFactory.createConnection(Constant.CONF);
            } catch (IOException e) {
                 e.printStackTrace();
            }
        }
        return connection;
    }

}
